package com.byxy.ssm.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.byxy.ssm.pojo.Tab;

public interface TabMapper {
	
	@Delete("delete from tab where tab_id=#{tabId}")
    int delete(Integer tabId);
	@Insert("insert into tab(tab_name) values(#{tabName})")
    int insert(Tab tab);

    @Select("select * from tab where tab_id=#{tabId}")
    @Results(id="dataset",value={
    	@Result(id=true,column="tab_id",property="tabId"),
    	@Result(column="tab_name",property="tabName"),
    })
    Tab getById(Integer tabId);
    @ResultMap("dataset")
    @Select("select * from tab")
    List<Tab> findAll();
    @Update("update tab set tab_name=#{tabName} where tab_id=#{tabId}")
    int update(Tab tab);
}